<?php

IncludeFunction("tour");
init();

function init()
{
    global $dbsql,$language;
    
    if($_GET['act']=='reset')
    {
        $dbsql->query('drop table tblbanner',true);
    }
    
    $table = "CREATE TABLE `tblbanner` (
              `iId` int(11) NOT NULL AUTO_INCREMENT,
              `cName` varchar(200) DEFAULT NULL,
              `iTourId` int(11) default null,
              `cImage` varchar(150)  DEFAULT NULL,
              `cDescription` text default null,
              `iStatus` int(1) DEFAULT NULL,
              `iOrder` int(11) default null,
              `iPostDate` int(11) DEFAULT NULL,
              `cLanguage` char(10) default null,
              PRIMARY KEY (`iId`)
            ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
            
            
    $tablehas = $dbsql->query("show tables like 'tblbanner';");
    if($dbsql->num_rows($tablehas)==0)
    {
        $dbsql->query($table,true);
    }    
}




function ListBanner()
{
    global $dbsql,$language;
    
    $sql_select = "select * from tblbanner where cLanguage='$language' order by iOrder";
    return $dbsql->load($sql_select);
}